﻿using System;
using System.Collections.Generic;
using System.Text;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using MiragePWF.NH.Validation;
using Wolfut.MirageEE.Kernal.Common;
using Wolfut.MirageEE.Domain.CommonUtilities;

namespace Wolfut.MirageEE.Domain.Products
{
    /// <summary>
    /// 商品销售价格信息
    /// </summary>
    [ActiveRecord("PRODUCT_SALE_PRICES")]
    public class ProductSalePrice : PersistentObjectWithGuid
    {
        #region 价格组合
        private PriceCompages priceCompages = PriceCompages.Customer;
        /// <summary>
        /// 价格组合
        /// </summary>
        [Property("PRICE_COMPAGES")]
        public virtual PriceCompages PriceCompages
        {
            get
            {
                return priceCompages;
            }
            set
            {
                priceCompages = value;
            }
        }
        #endregion

        #region 协议价格

        private Decimal protocolPrice;
        /// <summary>
        /// 协议价格
        /// </summary>
        [Property("PROTOCOL_PRICE")]
        public virtual Decimal ProtocolPrice
        {
            get
            {
                return protocolPrice;
            }
            set
            {
                protocolPrice = value;
            }
        }
        #endregion

        #region 协议折扣率
        private Decimal protocolDiscountRate;

        /// <summary>
        /// 协议折扣率
        /// </summary>
        [Property("PROTOCOL_DISCOUNT_RATE")]
        [ValidateRange(0, 100, "折扣率必须在0到100之间！")]
        public virtual Decimal ProtocolDiscountRate
        {
            get
            {
                return protocolDiscountRate;
            }
            set
            {
                protocolDiscountRate = value;
            }
        }
        #endregion

        #region 逻辑删除
        private Boolean isDeleted;
        /// <summary>
        /// 逻辑删除
        /// </summary>
        [Property("IS_DELETED")]
        public virtual Boolean IsDeleted
        {
            get
            {
                return isDeleted;
            }
            set
            {
                isDeleted = value;
            }
        }
        #endregion

        #region 商品
        private string productCode = string.Empty;
        /// <summary>
        /// 商品编号
        /// </summary>
        [Property("PRODUCE_NUMBER")]        
        [ValidateNonEmpty, ValidateLength(0, 100, "商品编号超长！")]
        public virtual string ProductCode
        {
            get
            {
                return productCode;
            }
            set
            {
                productCode = value;
            }
        }
        #endregion
    }
}
